package spi;

import lombok.Getter;
import lombok.Setter;

import java.util.Properties;
import java.util.UUID;

/**
 * 描述:uuid主键生成接口
 *
 * @author Madison You
 * @created 14:36
 */
@Getter
@Setter
public final class UUIDShardingKeyGenerator implements ShardingKeyGenerator {

    private Properties properties = new Properties();

    @Override
    public String getType() {
        return "UUID";
    }

    @Override
    public synchronized Comparable<?> generateKey() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }
}
